#include "stdafx.h"
#include "Sound.h"
Sound::Sound() {
	m_evt = NULL;
	m_playing = false;
}

Sound::Sound(unsigned int eventId) {
	m_evt = SoundPlayer::getInstance()->getEvent(eventId);
}

Sound::~Sound() {
	m_evt->release();
}

void Sound::play() {
	if(m_evt) {
		m_playing = true;
		m_evt->start();		
	}
}

void Sound::stop() {
	if(m_evt) {
		m_playing = false;
		m_evt->stop();
	}
}

void Sound::changeParam(const char* paramName, float paramValue) {
	if(m_evt) {
		FMOD::EventParameter* param;
		m_evt->getParameter(paramName, &param);
	    param->setValue(paramValue);	
	}
}

bool Sound::isPlaying() {
	return m_playing;
}
